Skip to content

FrozenError on profile/user delete - #1136

Merged
fbacall merged 1 commit into
ElixirTeSS:masterfrom
kennethrioja:patch-3
Aug 27, 2025
Merged

FrozenError on profile/user delete#1136
fbacall merged 1 commit into
ElixirTeSS:masterfrom
kennethrioja:patch-3

Conversation

@kennethrioja

Copy link
Copy Markdown
Contributor

Summary of changes

  • profile.rb: calling reindex_trainer only when creating and updating, not deleting.

Motivation and context

When deleting a user, a FrozenError was raised, this is due to the reindex_trainer method of the Profile model being called after a commit.

Discussions

One question raised by Finn was "we need to check what happens to the search index when the profile is deleted (e.g. does it cause an error because the profile is returned from the search service but can't be found in the database anymore)"

  1. Register user, delete immediately:
    a. They are present in table users, not in table profiles, not in solr
    b. Deleting does the FrozenError
    c. Then they are not present in db anymore (nor in solr)
  2. Register user, update profile, not ticking trainer
    a. Present in Profile solr search (in rails console, Profile.where)
    b. Deleting does the FrozenError, then not present in solr search (Profile)
  3. Register user, update profile as trainer:
    a. After updating as a trainer, they are present in a Trainers solr search (in rails console, Trainer.search { fulltext 'Kenneth' }.results)
    b. Deleting does the FrozenError, then they are both not present in db and in solr search (either in Trainer nor in Profile)

Redoing it with the amended callback after_commit :reindex_trainer, on: %i[create update]

  1. Register user, delete immediately:
    a. Not found in Solr search
    b. After deleting, no more FE
    c. Not present in db nor solr search
  2. Register user, update firstname and surname, not ticking trainer
    a. Not found in Solr search (Profile and Trainer)
    b. After deleting, no more FE
    c. Not present in db nor solr search
  3. Register user, ticking trainer
    a. Searchable through Trainer.search
    b. After deleting, no FE
    c. Not present in db, and Trainer.search does not find anything

Checklist

  • I have read and followed the CONTRIBUTING guide.
  • I confirm that I have the authority necessary to make this contribution on behalf of its copyright owner and agree
    to license it to the TeSS codebase under the
    BSD license.

@kennethrioja kennethrioja changed the title fix(profile): frozen error on profile/user delete FrozenError on profile/user delete Aug 11, 2025
@fbacall
fbacall merged commit 2ad373a into ElixirTeSS:master Aug 27, 2025
7 checks passed
@kennethrioja
kennethrioja deleted the patch-3 branch January 7, 2026 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants